package ac.github.os.internal.core.condition

import ac.github.os.internal.core.NameKey
import ac.github.os.internal.core.config.StringConfig
import ac.github.os.internal.core.trigger.Trigger
import ac.github.os.internal.session.Session

interface Condition : NameKey {

    fun doScreen(session: Session, config: StringConfig): Boolean

}

inline fun <reified T> Session.callVoid(callback: (T) -> Unit) {
    if (T::class.java.isInstance(trigger)) {
        callback(trigger as T)
    }
}

inline fun <reified T> Session.call(callback: (T) -> Boolean): Boolean {
    return if (T::class.java.isInstance(trigger)) {
        callback(trigger as T)
    } else false
}

